home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17224 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: sizeof() question >>> :)
  5. Date: 14 Apr 1996 09:02:59 -0700
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4kr7jjINN1m7@keats.ugrad.cs.ubc.ca>
  8. References: <1996Apr12.061927@topaz> <4kp5dv$3vu@nadine.teleport.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4kp5dv$3vu@nadine.teleport.com>,
  12. Jeff Grossman  <grossman@teleport.com> wrote:
  13.  >naderr@topaz.cqu.edu.au wrote:
  14.  >>Hi,
  15.  >>
  16.  >>How can I get, with a pointer,  the sizeof  of an  array that is
  17.  >>pointed by the pointer ?  (No it's not a tounge twister :)
  18.  >>
  19.  >
  20.  >[code snippet snipped]
  21.  >
  22.  >If I followed your question correctly, you're not looking for
  23.  >an array size but a string length. Try looking at the strlen
  24.  >function.
  25.  
  26. No he isn't, and hence, no you didn't :)
  27.  
  28. The string length of his arrays, before he reads input into them, is undefined
  29. or zero depending on whether their storage type is auto or static.
  30.  
  31. A computation of string length is of absolutely no use here whatsoever, since
  32. he wants to know the destination buffer size that he is reading into, and
  33. therefore the array size is of utmost interest.
  34.